package com.nikunj.www.hibernate.dao.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.nikunj.www.hibernate.dao.PersonDAO;
import com.nikunj.www.hibernate.model.Person;

@Service
public class PersonDAOImpl implements PersonDAO {

	@Autowired
	private SessionFactory sessionFactory;

	@SuppressWarnings("unchecked")
	public List<Person> getPersons() {
		Criteria criteria = sessionFactory.getCurrentSession().createCriteria(
				Person.class);
		return criteria.list();
	}
}
